﻿using System;
using System.Collections.Generic;
using System.Text;

namespace 继承测试_MM路径
{
	class Date : CalendarUnit
	{
		private Day m_day;
		private Month m_month;
		private Year m_year;

		public Date(int month, int day, int year)
		{
			m_year = new Year(year);//msg4
			m_month = new Month(month, m_year);//msg5
			m_day = new Day(day, m_month);//msg6


		}

		public override bool Increment()
		{
			if (m_day.Increment() == false)//msg7
			{
				if (m_month.Increment() == false)//msg8
				{
					m_year.Increment();//msg9
					m_month.SetMonth(1, m_year);//msg10
				}
				else
				{
					m_day.SetDay(1, m_month);//msg11
				}

			}
			return true;
		}

		public string GetDateString()
		{
			string result = "";

			result = m_year.GetYear().ToString() + "/"//msg12
					 + m_month.GetMonth().ToString() + "/"//msg13
					 + m_day.GetDay().ToString();//msg14
			return result;
		}
	}
}
